//
//  JCPlanningModelController.m
//  JiFengDaRen
//
//  Created by shouhan on 2018/5/21.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCPlanningModelController.h"
#import "JCModelTableViewCell.h"
#import "JCPlanIntelligentController.h"
#import "JCPlanViewController.h"

@interface JCPlanningModelController()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView * modelTableView;

@property (nonatomic, strong) NSMutableDictionary * dicContent;

@end

@implementation JCPlanningModelController

- (void)viewDidLoad {
    [super viewDidLoad];
 
    [self initUI];
    
    [self modelTableView];
}

- (void)initUI{
    self.title = @"计划模式";
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.row == 0) {
        JCPlanIntelligentController * VC = [[JCPlanIntelligentController alloc] init];
        VC.model = self.model;
        [self.navigationController pushViewController:VC animated:YES];
    }
    else{
        JCPlanViewController * VC = [[JCPlanViewController alloc] init];
        VC.model = self.model;
        [self.navigationController pushViewController:VC animated:YES];
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    JCModelTableViewCell * cell = [JCModelTableViewCell tableViewCellWithTableView:tableView];
    [cell getDicContent:self.dicContent andIndexRow:indexPath.row];
    [cell layoutIfNeeded];
    return cell;
}

- (UITableView *)modelTableView{
    if (!_modelTableView) {
        _modelTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
        _modelTableView.delegate = self;
        _modelTableView.dataSource = self;
        _modelTableView.estimatedRowHeight = 100;
        _modelTableView.rowHeight = UITableViewAutomaticDimension;
        _modelTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_modelTableView];
    }
    return _modelTableView;
}

- (NSMutableDictionary *)dicContent{
    if (!_dicContent) {
        _dicContent = [NSMutableDictionary dictionaryWithObjectsAndKeys:@[@"intelligent",@"customImage"],@"icon",@[@"智能还款",@"自定义还款"],@"title",@[@"一键搞定自己的完美账单",@"选择适合自己的完美账单"],@"content", nil];
    }
    return _dicContent;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
